home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / internet / net commander 1.0 / ISP / SCRPTLST / PACKET.CMD < prev    next >
Encoding:
Text File  |  1996-03-01  |  3.8 KB  |  187 lines

  1. #  Login.cmd for PacketWorks, Inc.
  2. #
  3. #
  4. #  Trumpet Winsock 2.1 Login.cmd
  5. #
  6. #  Copyright (C) 1994,1995 Peter R. Tattam & 
  7. #  Trumpet Software International Pty Ltd (TSI)
  8. #  All rights reserved.
  9. #
  10. #  Unless TSI has given prior written consent to such use, 
  11. #  no permission is granted to distribute or otherwise make available 
  12. #  to the public modified versions of this script for commercial purposes.  
  13. #  Any permitted distribution of modified versions of the script must
  14. #  retain the copyright notice at the start of this file and must clearly 
  15. #  identify those parts of the file which have been modified.
  16. #
  17. #trace on
  18. #
  19. # set up some strings for dialling up
  20. #
  21. if ![load $number]
  22.   if [query $number "Enter your dial up phone number"]
  23.     save $number
  24.   end
  25. end
  26. if ![load $username]
  27.   if [username "Enter your login username"]
  28.     save $username
  29.   end
  30. end
  31. if ![load $password]
  32.   if [password "Enter your login password"]
  33.     save $password
  34.   end
  35. end
  36. $modemsetup = "&c1&k3"
  37. $prompt = ">"
  38. $userprompt = "sername:"
  39. $passprompt = "assword:"
  40. $slipcmd = "slip"
  41. $add
  42. rtarg = "our address is"
  43. $pppcmd = "ppp"
  44. $pppready = "PPP."
  45. %attempts = 10
  46.  
  47. ###############################################
  48. # timeouts for various sections of the script #
  49. ###############################################
  50. #
  51. # timeout for busy tone... adjust this until the BUSY string is detected.
  52. #
  53. %busytimeout = 10
  54. #
  55. # time between successive busy attempts.
  56. #
  57. %busywait = 30
  58. #
  59. # time to wait for a CONNECT string to be received
  60. #
  61. %connecttimeout = 60
  62. #
  63. # time to wait until DCD is detected
  64. #
  65. %onlinetimeout = 60
  66. #
  67. # time to wait for username & password prompts
  68. #
  69. %logintimeout = 60
  70. #
  71. # time to wait for server prompt to appear
  72. #
  73. %prompttimeout = 30
  74. #
  75. # time to wait for a SLIP address to be parsed
  76. #
  77. %addresstimeout = 30
  78. #
  79. #
  80. #
  81. #
  82. #----------------------------------------------------------
  83. #
  84. # initialize modem
  85. #
  86. status "Initializing modem..."
  87. output "atz"\13
  88. if ! [input 5 OK\n]
  89.   message "Modem is not responding"
  90.   abort
  91. end
  92. #
  93. # setup our modem commands
  94. #
  95. output "at"$modemsetup\13
  96. if ! [input 10 OK\n]
  97.   message "Modem i
  98. s not responding"
  99.   abort
  100. end
  101. #
  102. # send phone number
  103. #
  104. %n = 0
  105. repeat
  106.   %n = %n + 1
  107.   if %n > %attempts
  108.     message "Too many dial attempts"
  109.     abort
  110.   end
  111.   status Dialling $number...(attempt %n)
  112.   output "atdt"$number\13
  113.   %busy = [input %busytimeout BUSY]
  114.   if %busy
  115.     status "The line is busy...pausing for a while"
  116.     sleep %busywait
  117.     %ok = 0
  118.   else
  119.     %ok = [input %connecttimeout CONNECT]
  120.   end
  121. until %ok
  122. input 10 \n
  123. #
  124. #  wait till it's safe to send because some modem's hang up
  125. #  if you transmit during the connection phase
  126. #
  127. wait %onlinetimeout dcd
  128. status Connected.  Now logging in as $username...
  129. #
  130. # now prod the terminal server
  131. #
  132. #output \13
  133. #
  134. #  wait for the username prompt
  135. #
  136. input %logintimeout $userprompt
  137. output $username\13
  138. #
  139. # and the password
  140. #
  141. input %logintimeout $passprompt
  142. output $password\13
  143. #
  144. # we are now logged in
  145. #
  146. status "Logged in. Now switching to Internet..."
  147. input %prompttimeout $prompt
  148. if %ppp
  149.   #
  150.   # jump into ppp mode
  151.   #
  152.   output $pppcmd\13
  153.   #
  154.   # wait for PPP prompt.
  155.   inpu
  156. t %prompttimeout $pppready
  157.   #
  158.   display \n\n"PPP mode selected.  Will try to negotiate IP address."\n
  159.   status "PPP mode selected.  Will try to negotiate IP address."
  160.   sleep 1
  161.   #
  162. else
  163.   #
  164.   # jump into slip mode
  165.   #
  166.   output $slipcmd\13
  167.   #
  168.   # wait for the address string
  169.   #
  170.   input %addresstimeout $addrtarg
  171.   #
  172.   # parse address
  173.   #
  174.   address 30
  175.   input %addresstimeout \n
  176.   #
  177.   # we are now connected, logged in and in slip mode.
  178.   #
  179.   display \n
  180.   display Connected.  Your IP address is \i.\n
  181.   status Connected.  Your IP address is \i.
  182.   sleep 1
  183. end
  184. #
  185. # now we are finished.
  186. #
  187.